
import time 
from typing import Callable

class Timer:
    _accumulate: float = 0.0
    
    @staticmethod
    def func_time_recoder(func, *args, **kwargs):
        start = time.time()
        ret = func(*args, **kwargs)
        end = time.time()
        return ret, start, end
    
    @staticmethod
    def time(func):
        def wrapper(*args, **kwargs):
            ret, start, end = Timer.func_time_recoder(func, *args, **kwargs)
            print(f'Time: {end - start}')
            return ret
        return wrapper
    
    def accumulate(self, func: Callable):
        def wrapper(*args, **kwargs):
            ret, start, end = Timer.func_time_recoder(func, *args, **kwargs)
            self._accumulate += end - start
            return ret
        return wrapper
    
    def get_accumulate(self):
        return self._accumulate


